package response

type ResCodeInt int64

const (
	CodeSuccess ResCodeInt = 0 + iota
	CodeInvalidParam
	CodeUserExist
	CodeServerBusy
	CodeJwtAuthEmpty
	CodeJwtAuthError
	CodeJwtAuthInvalid
)

var CodeMsgMap = map[ResCodeInt]string{
	CodeSuccess:        "success",
	CodeInvalidParam:   "参数验证失败",
	CodeUserExist:      "用户已存在",
	CodeServerBusy:     "服务繁忙",
	CodeJwtAuthEmpty:   "请求头中auth为空",
	CodeJwtAuthError:   "请求头中auth格式有误",
	CodeJwtAuthInvalid: "无效的token",
}

func (r ResCodeInt) Msg() string {
	msg, ok := CodeMsgMap[r]
	if !ok {
		msg = CodeMsgMap[CodeServerBusy]
	}
	return msg
}
